import api from './api';
import { LoginParams, LoginResponse, RegisterParams } from '../types/auth';
import { AxiosResponse } from 'axios';

/**
 * 用户登录
 * @param data - 包含用户名和密码的对象
 * @returns Promise<AxiosResponse<LoginResponse>>
 */
export const login = (data: LoginParams): Promise<AxiosResponse<LoginResponse>> => {
  return api.post('/auth/login', data);
};

/**
 * 用户注册
 * @param data - 包含用户名、密码和邮箱的对象
 * @returns Promise<AxiosResponse>
 */
export const register = (data: RegisterParams): Promise<AxiosResponse> => {
    return api.post('/auth/register', data);
}; 